<template>
	<layout>
	<h2>项目配置</h2>
	<hr />
	<el-button type="primary" @click="add">新增项目</el-button>
    <br><br/>
    <el-table :data="tableData" border stripe style="width: 80%">
    	<el-table-column  prop="no" label="项目编号" width="120"></el-table-column>
    	<el-table-column prop="name" label="项目名称" width="150"></el-table-column>
    	<el-table-column label="操作">
    		<template scope="scope">
    			<el-button type="text" size="small" @click="Edit">编辑</el-button>
    			<el-button type="text" size="small" @click="Delete(index)">删除</el-button>
    		</template>
    	</el-table-column>	
    </el-table>
	</layout>
</template>

<script type="text/javascript">
import Layout from './Home.vue'
import axios from 'axios'
export default{
	components:{
		Layout
	},
	data(){
		return {
			tableData:[{
				no:'3',
				name:'ccc'
			},
			{
				no:'4',
				name:'d'
			},
			{
				no:'1',
				name:'教改'
			},
			{
				no:'2',
				name:'职称'
			}]
		}
	},
	methods:{
		add(){

		},
		Edit(){
			
		},
		Delete(index){
			axios.get('/api/project/del?id='+ this.tableData.no ).then(function(r){
				if(r.data.error == 0){
					this.tableData.remove(zz);
				}
			}).catch(function(error){
				console.log(error);
			});
		}
	}
}
</script>